package com.sysfrog.cucumber.lexer;

/*
* Copyright (C) 2010 Thomas Heggelund
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
*/

import com.sysfrog.cucumber.psi.CucumberElementType;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.TokenType;
import com.sysfrog.cucumber.CucumberLanguage;
import com.sysfrog.cucumber.CucumberFileType;

public interface CucumberTokenTypes {
    static CucumberLanguage language = CucumberFileType.CUCUMBER;


    // Special characters
    IElementType LEFT_PAREN = new CucumberElementType("(");
    IElementType RIGHT_PAREN = new CucumberElementType(")");

    IElementType LEFT_CURLY = new CucumberElementType("{");
    IElementType RIGHT_CURLY = new CucumberElementType("}");

    IElementType LEFT_SQUARE = new CucumberElementType("[");
    IElementType RIGHT_SQUARE = new CucumberElementType("]");

    IElementType UNQUOTE = new CucumberElementType("~");
    IElementType DEREF = new CucumberElementType("@");
    IElementType DOT = new CucumberElementType(".");
    IElementType REST = new CucumberElementType("&");
    IElementType BACKQUOTE = new CucumberElementType("`");
    IElementType QUOTE = new CucumberElementType("'");
    IElementType COMMA = new CucumberElementType(",");
    IElementType METADATA = new CucumberElementType("#^");
    IElementType META = new CucumberElementType("^");
    IElementType REGEX = new CucumberElementType("#");
    IElementType VAR_QUOTE = new CucumberElementType("#'");
    IElementType UNQUOTE_SPLICE = new CucumberElementType(",@");

    // This guy is a little special, at least within single-var anonymous fn definitions
    IElementType ANONYMOUS_PARAM = new CucumberElementType("%");

    TokenSet SPECIAL_CHARACTERS = TokenSet.create(UNQUOTE, DEREF, METADATA, META, REGEX, REST, VAR_QUOTE, DOT, BACKQUOTE, QUOTE, COMMA, UNQUOTE_SPLICE);

    // Keywords and special forms (as well as some keywords that behave like
    IElementType DEF = new CucumberElementType("def");

    IElementType QUOTE_KEYWORD = new CucumberElementType("quote");
    IElementType META_KEYWORD = new CucumberElementType("meta");
    IElementType IF = new CucumberElementType("if");
    IElementType COND = new CucumberElementType("cond");
    IElementType LOOP = new CucumberElementType("loop");
    IElementType RECUR = new CucumberElementType("recur");
    IElementType VAR = new CucumberElementType("var");
    IElementType THROW = new CucumberElementType("throw");
    IElementType TRY = new CucumberElementType("try");
    IElementType NEW = new CucumberElementType("new");
    IElementType SET = new CucumberElementType("set!");
    IElementType MONITOR_ENTER = new CucumberElementType("monitor-enter");
    IElementType MONITOR_EXIT = new CucumberElementType("monitor-exit");

    IElementType DO = new CucumberElementType("do");
    IElementType LET = new CucumberElementType("let");

    TokenSet SPECIAL_FORMS = TokenSet.create(DEF, COND, IF, DO, LET, LOOP, RECUR, VAR, THROW, TRY, NEW, SET);

    IElementType DEFN = new CucumberElementType("defn");
    IElementType DEFMACRO = new CucumberElementType("defmacro");
    IElementType DEFMETHOD = new CucumberElementType("defmethod");
    IElementType DEFMULTI = new CucumberElementType("defmulti");
    IElementType DEFSTRUCT = new CucumberElementType("defstruct");
    IElementType FN = new CucumberElementType("fn");

    TokenSet PSEUDO_SPECIAL_FORMS = TokenSet.create(DEF, DEFN, DEFMACRO, DEFMULTI, DEFMETHOD, DEFSTRUCT, FN);

    // Comments
    IElementType BLOCK_COMMENT = new CucumberElementType("block comment");
    IElementType LINE_COMMENT = new CucumberElementType("line comment");
    TokenSet COMMENTS = TokenSet.create(BLOCK_COMMENT, LINE_COMMENT);


    // Literals
    IElementType STRING_LITERAL = new CucumberElementType("string literal");
    IElementType NUMERIC_LITERAL = new CucumberElementType("numeric literal");
    IElementType CHAR_LITERAL = new CucumberElementType("character literal");

    IElementType TRUE = new CucumberElementType("true");
    IElementType FALSE = new CucumberElementType("false");
    IElementType NIL = new CucumberElementType("nil");
    TokenSet BOOLEAN_LITERAL = TokenSet.create(TRUE, FALSE, NIL);

    TokenSet LITERALS = TokenSet.create(STRING_LITERAL, NUMERIC_LITERAL, CHAR_LITERAL, TRUE, NIL);
    TokenSet READABLE_TEXT = TokenSet.create(STRING_LITERAL, BLOCK_COMMENT, LINE_COMMENT);


    IElementType KEYWORD = new CucumberElementType("keyword");
    IElementType SYMBOL = new CucumberElementType("symbol");
    IElementType CLASSNAME = new CucumberElementType("classname");
    TokenSet SYMBOL_FILTER = TokenSet.create(SYMBOL);


    // Control characters
    IElementType EOL = new CucumberElementType("EOL");
    IElementType EOF = new CucumberElementType("end of file");
    IElementType WHITESPACE = TokenType.WHITE_SPACE;
    IElementType BAD_CHARACTER = TokenType.BAD_CHARACTER;

    TokenSet WHITESPACE_SET = TokenSet.create(EOL, EOF, WHITESPACE);
}
